//
//  AppDelegate.swift
//  FollowmeMac
//
//  Created by Subo on 2018/2/13.
//  Copyright © 2018年 Followme. All rights reserved.
//

import Cocoa
import macOSThemeKit

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {



    func applicationDidFinishLaunching(_ aNotification: Notification) {
        configTheme()
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        // Insert code here to tear down your application
    }


}

// MARK: - Theme
extension AppDelegate {
    func configTheme() {
        //Setup window theme policy
        ThemeManager.shared.windowThemePolicy = .themeAllWindows
        //ThemeManager.shared.windowThemePolicy = .themeSomeWindows(windowClasses: [MyCustomWindow.self])
        //ThemeManager.shared.windowThemePolicy = .doNotThemeSomeWindows(windowClasses: [NSPanel.self])
        //ThemeManager.shared.windowThemePolicy = .doNotThemeWindows
        
        // 2.2 User themes folder
        if let bundleResourcePath = Bundle.main.resourcePath {
            ThemeManager.shared.userThemesFolderURL = URL(fileURLWithPath: bundleResourcePath)
            NSLog("ThemeManager.shared.userThemesFolderURL: %@", ThemeManager.shared.userThemesFolderURL?.path ?? "-")
        }
        
        //Set default theme (default: macOS theme `ThemeManager.systemTheme`)
        ThemeManager.defaultTheme = ThemeManager.darkTheme
        //Apply last applied theme, or the default one
        ThemeManager.shared.applyLastOrDefaultTheme()
    }
}
